<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
	xmlns:c="http://xmlns.jcp.org/jsf/composite"
	xmlns:p="http://primefaces.org/ui">

<ui:decorate template="/jsp/WEB/pageLayout.xhtml">
	<ui:define name="centro">
		<h:form id="form">
		<p:growl id="msgs" showDetail="true" />
			<!-- ************************************************************************ -->
			<!-- ** Dados dos pedidos -->
			<!-- ************************************************************************ -->
			<p:panel id="ListPed" header="Extrato de Cliente" style="width:250%">

				<f:facet name="actions">
					<h:commandLink
						styleClass="ui-panel-titlebar-icon ui-corner-all ui-state-default">
						<h:outputText styleClass="ui-icon ui-icon-print" title="Imprimir" />
						<p:printer target="tabelaUsu" />
					</h:commandLink>

					<h:commandLink
						styleClass="ui-panel-titlebar-icon ui-corner-all ui-state-default"
						style="width:16px;heigh:16px;">
						<p:graphicImage style=" margin-top:1px;margin-left:2px"
							title="Exportar relatório para excel" url="/imagens/ui-xls.png"></p:graphicImage>
						<p:dataExporter type="xls" target="tabelaUsu"
							fileName="Extrato de cliente" />
					</h:commandLink>

				</f:facet>

				<p:panel header="Consulta por cliente">
					<table cellpadding="0" cellspacing="3" border="0">
						<tr>
							<td
								style="align: left; height: 30px; margin-top: 0px; margin-right: 5%"><p:selectOneMenu
									id="Situacao" value="#{ExtratoCliBean.tpConsulta}">

									<f:selectItem itemLabel="CPF" itemValue="1" />
									<f:selectItem itemLabel="Nome" itemValue="2" />
								</p:selectOneMenu></td>
							<td style="height: 30px; margin-top: 0px; margin-left: 5%"><p:inputText
									id="maskCPF" value="#{ExtratoCliBean.consulta}" /></td>

							<td style="align: left; height: 30px; margin-top: 0px"><p:commandButton
									id="searchUser" style="margin-left:5px" image="ui-icon-search"
									update="@form" ajax="false" title="Consultar cliente"
									actionListener="#{ExtratoCliBean.exibirRelatorio}" /></td>
							<td
								style="margin-left: 60%; height: 30px; width: 80%; margin-right: 50%; margin-top:0%"><p:panel
									header="Valor total Geral: R$ #{ExtratoCliBean.extratoSoma.valorSomaTotal}"
									style="width:30%;border:0px;margin-top:2%;margin-left:10%" /></td>

						</tr>
					</table>
				</p:panel>



				<p:dataTable id="tabelaUsu" value="#{ExtratoCliBean.rel}" var="rel"
					widgetVar="relTable" rowIndexVar="rowIndex"
					emptyMessage="Nenhum registro encontrado" style="margin-top: 30px;"
					paginator="true" rows="20" rowsPerPageTemplate="10,20,30,40,50"
					filteredValue="#{ExtratoCliBean.relFiltrado}"
					sortBy="#{rel.idPedido}">

					<f:facet name="header">
						<p:outputPanel>
							<h:outputText value="Buscar todos os campos:" />
							<p:inputText id="globalFilter" onkeyup="PF('relTable').filter()"
								style="width:150px" placeholder="Digite a palavra" />
						</p:outputPanel>
					</f:facet>

					<p:column filterBy="#{rel.idPedido}" sortBy="idPedido"
						style="text-align:center;width:10px" headerText="Nº Pedido"
						filterMatchMode="contains">
						<h:outputText value="#{rel.idPedido}" />
					</p:column>

					<p:column filterBy="#{rel.numCard}" sortBy="numCard"
						style="text-align:center" headerText="Nº Cartão"
						filterMatchMode="contains">
						<h:outputText value="#{rel.numCard}" />
					</p:column>

					<p:column filterBy="#{rel.numSerie}" sortBy="numSerie"
						style="text-align:center" headerText="Nº POS"
						filterMatchMode="contains">
						<h:outputText value="#{rel.numSerie}" />
					</p:column>

					<p:column filterBy="#{rel.descMerc}" sortBy="descMerc"
						headerText="Produto"
						filterMatchMode="contains">
						<h:outputText value="#{rel.descMerc}" style="text-align:left" />
					</p:column>


					<p:column filterBy="#{rel.qtde}" sortBy="qtde"
						style="text-align:center" headerText="Quantidade"
						filterMatchMode="contains">
						<h:outputText value="#{rel.qtde}" />
					</p:column>

					<p:column filterBy="#{rel.valorUnit}" sortBy="valorUnit"
						style="text-align:center" headerText="Valor Unitário R$"
						filterMatchMode="contains">
						<h:outputText value="#{rel.valorUnit}" />
					</p:column>

					<p:column filterBy="#{rel.valorTotal}" sortBy="valorTotal"
						style="text-align:center" headerText="Valor Total R$"
						filterMatchMode="contains">
						<h:outputText value="#{rel.valorTotal}" />
					</p:column>

					<p:column filterBy="#{rel.cancelado}" sortBy="cancelado"
						style="text-align:center" headerText="Cancelado"
						filterMatchMode="contains">
						<h:outputText value="Sim" rendered="#{rel.cancelado}" />
						<h:outputText value="Não" rendered="#{not rel.cancelado}" />
					</p:column>


					<p:column filterBy="#{rel.dataPedido}" sortBy="dataPedido"
						style="text-align:center" headerText="Data Pedido"
						filterMatchMode="contains">
						<h:outputText value="#{rel.dataPedido}">
							<f:convertDateTime locale="pt_BR" pattern="dd/MM/yyyy" />
						</h:outputText>
					</p:column>

					<p:column filterBy="#{rel.horaPedido}" sortBy="horaPedido"
						style="text-align:center" headerText="Hora Pedido"
						filterMatchMode="contains">
						<h:outputText value="#{rel.horaPedido}" />
					</p:column>


					<p:column filterBy="#{rel.statusPedido}" sortBy="statusPedido"
						style="text-align:center" headerText="Ped. Finalizado"
						filterMatchMode="contains">
						<h:outputText value="Sim" rendered="#{rel.statusPedido}" />
						<h:outputText value="Não" rendered="#{not rel.statusPedido}" />
					</p:column>

					<p:column filterBy="#{rel.dataFechamento}" sortBy="dataFechamento"
						style="text-align:center" headerText="Data Fechamento Ped.">
						<h:outputText value="#{rel.dataFechamento}"
							filterMatchMode="contains">
							<f:convertDateTime locale="pt_BR" pattern="dd/MM/yyyy" />
						</h:outputText>
					</p:column>

					<p:column filterBy="#{rel.horaFechamento}" sortBy="horaFechamento"
						style="text-align:center" headerText="Hora Fechamento Ped."
						filterMatchMode="contains">
						<h:outputText value="#{rel.horaFechamento}" />
					</p:column>


					<!--  <p:summaryRow>
						<p:column  style="text-align:right">
							<h:outputText value="Total Pedido:" />
						</p:column>
						<p:column>
							<h:outputText value="#{rel.valorTotal}">
								<f:convertNumber type="currency" currencySymbol="$" />
							</h:outputText>
						</p:column>
					</p:summaryRow>-->

					<!--	<p:columnGroup type="footer">
						<p:row>
							<p:column colspan="5" footerText="Total R$:" />
							<p:column
								footerText="#{ExtratoCliBean.extratoSoma.valorSomaTotal}" />
						</p:row>
					</p:columnGroup> -->

				</p:dataTable>

			</p:panel>
		</h:form>
	</ui:define>
</ui:decorate>
</html>
